﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using dhSystemBLL.basicData;
using dhDataAcess.Model;
using dhDataAcess.dataAcess;
using dhDataAcess.dataAcess.sysDataSetTableAdapters;


namespace baseSet.importExport
{
    public class DcolumnSet
    {
        public static  void colSet(string modulNum, DataGridView dGrid)
        {
            itemListBLL item = new itemListBLL();
            sysDataSet.itemListDataTable itemList = item.getitemListBymoduleNum(modulNum);
            foreach (sysDataSet.itemListRow itemRow in itemList)
            { 
                foreach (DataGridViewColumn col in dGrid.Columns)
                {
                  
                    if (col.Name == itemRow.itemName)
                    {
                       
                        col.HeaderText = itemRow.itemDispC;
                        col.Width = itemRow.itemWidth;
                        col.Visible = itemRow.itemDispNo;
                        col.DisplayIndex = itemRow.itemDispIndex;
                    }
                }
            }
        }

        public static void setGridViewRowNum(DataGridViewRowPostPaintEventArgs e, DataGridView dGrid)
        {

            System.Drawing.Rectangle rectangle = new System.Drawing.Rectangle(e.RowBounds.Location.X,

            e.RowBounds.Location.Y,

            dGrid.RowHeadersWidth - 4,

            e.RowBounds.Height);



            TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(),

                dGrid.RowHeadersDefaultCellStyle.Font,

                rectangle,

                dGrid.RowHeadersDefaultCellStyle.ForeColor,

                TextFormatFlags.VerticalCenter | TextFormatFlags.Right);

        }
    }
}
